home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Development Platforms / Apple II / Essentials / Technical.Notes / AIIe / TN.AIIE.005 < prev    next >
Encoding:
Text File  |  1989-04-22  |  12.2 KB  |  254 lines  |  [TEXT/pdos]

  1. Apple II
  2. Technical Notes
  3. _____________________________________________________________________________
  4.                                                   Developer Technical Support
  5.  
  6.  
  7. Apple IIe
  8. #5:    /INH Line
  9.  
  10. Revised by:    Glenn A. Baxter                                  November 1988
  11. Written by:    Peter Baum                                            May 1984
  12.  
  13. This Technical Note describes how a peripheral card on the Apple IIe should 
  14. use the inhibit (/INH) line.  This information is true for the Apple IIe only.
  15. _____________________________________________________________________________
  16.  
  17.  
  18. Using the /INH Line on the Apple IIe
  19.  
  20. Overview
  21.  
  22. One of the new features of the Apple IIe is the ability to add more memory or 
  23. override existing memory from a peripheral card.  This feature, which uses the 
  24. /INH line on the peripheral slots, has been expanded from its original purpose 
  25. on the Apple ][+ of disabling the on-board ROM and allowing the language card 
  26. (RAM) to reside in the same address space.  The Apple IIe allows any part of 
  27. memory to be replaced by memory on a peripheral card.  This Note explains how 
  28. a peripheral card should use the /INH line.
  29.  
  30. Uses
  31.  
  32. Presently, only a few peripheral devices use the /INH line in the IIe for 
  33. memory expansion.  One type of card uses /INH for RAM expansion by switching 
  34. in extra language cards, while another class of cards uses it to extend the 
  35. built-in 80-column ROM code by replacing it with their own ROM code.  Other 
  36. cards use /INH so that they can have more than one stack and zero page.  
  37. Future peripheral cards can take advantage of the /INH line to do even fancier 
  38. memory expansion, such as keeping multiple programs running in memory at the 
  39. same time.
  40.  
  41. More memory, either ROM or RAM, can be added by mapping the memory into the 
  42. same address space as existing memory.  The processor can then select which 
  43. memory, the on-board or the additional, it wants to use by setting a register 
  44. (or soft switch).  This technique of switching different blocks of memory into 
  45. the same address space is called bank switching.  An example of this technique 
  46. for extending memory is found in the Apple ][+ language card and in the bank 
  47. switched memory on the IIe.
  48.  
  49. How It Works
  50.  
  51. When the /INH line, pin 32 in slots 1-7, is pulled low, all memory on the 
  52. motherboard and in the auxiliary slot is disabled (including memory on the 80-
  53. column and extended 80-column cards).  This action allows a peripheral card in 
  54. slots 1-7 to enable its memory onto the bus.
  55.  
  56. When the 6502 reads a byte from memory, the data typically comes from one of 
  57. three places:  motherboard ROM, motherboard RAM, or RAM on one of the 80-
  58. column cards in the auxiliary slot.  When the /INH line is pulled low, all of 
  59. the above mentioned ROM and RAM is disabled and will not drive the data bus.  
  60. This disabling allows the peripheral slots to drive the bus by enabling data 
  61. onto it.  The 6502 will then read data from the peripheral card instead of a 
  62. location on the motherboard or auxiliary slot.
  63.  
  64. During a 6502 write cycle, if the /INH line is pulled low, then motherboard 
  65. and auxiliary card RAM are both disabled.  A peripheral card can then read a 
  66. byte off the data bus and store it.
  67.  
  68. Implementation
  69.  
  70. Because pulling the /INH line low disables all of memory, the peripheral card 
  71. must be very careful when it does this.  If only a small piece of memory is to 
  72. be banked into a specific address space, then the /INH line should only be 
  73. pulled on memory references to that address space.  Otherwise the motherboard 
  74. memory will be disabled and the processor will read or write to the wrong 
  75. memory and the program will not work properly.  For example, if a peripheral 
  76. card wants to replace the zero page with memory on the card, then the /INH 
  77. line should be pulled low only on references to the address space between $0 
  78. and $FF.  If the /INH line is pulled during a processor instruction fetch from 
  79. the monitor ROM at $F800, the 6502 will read the wrong instruction (or a 
  80. floating bus) and probably crash the program.
  81.  
  82. Pulling the /INH line at specific addresses is called select decoding.  The 
  83. hardware on the peripheral card does this by checking the address bus of the 
  84. 6502, and if the address falls in the correct range, the card pulls the /INH 
  85. line low.  In the earlier example of a new zero page, if the address bus was 
  86. in the range $0-$FF the card would pull /INH low.
  87.  
  88.  
  89. Differences:  IIe vs. ][+
  90.  
  91. On the Apple ][+, select decoding was not necessarily needed because the /INH 
  92. line only affected the ROM and not the RAM.  If the Apple ][+ peripheral card 
  93. wanted to bank in extra language cards at the addresses $D000-$FFFF, then it 
  94. could pull the /INH line and keep it low during any memory access.  This 
  95. action would disable the on-board ROM and not any other memory accesses such 
  96. as zero page or stack.  This same card would not work in the IIe, since the 
  97. next instruction fetch to RAM after pulling /INH low would read a floating bus 
  98. because all the memory would be disabled.
  99.  
  100.  
  101. Another Feature
  102.  
  103. For those of you who love to muck around in the guts of the Apple IIe, one 
  104. more feature has been added to the /INH function.  The /INH line will also 
  105. override DMA accesses to memory on the motherboard.  This override means that 
  106. if a peripheral card uses DMA to read or write to memory, another peripheral 
  107. card could pull the /INH line and process the DMA access.  An example of this 
  108. would be a co-processor card using the memory on a RAM card in another slot.  
  109. Rather than have the co-processor write to the memory on the motherboard then 
  110. have the 6502 write to the RAM card, the co-processor can write to an address 
  111. that the RAM card recognizes.  The RAM card could then pull the /INH line and 
  112. it would be free to read or write the data bus.  This technique could also be 
  113. used by a co-processor to write directly to a printer card in another slot.
  114.  
  115.  
  116. Timing
  117.  
  118. The peripheral card must wait for the address bus to settle, which occurs a 
  119. maximum of 190 ns after the falling edge of 0o, before pulling the /INH line.  
  120. (The 6502A maximum address setup time is 140 ns from 02, with a worst case 
  121. 6502A skew of 50 ns from 0o to 02.)  To guarantee that the RAM is disabled and 
  122. a write does not accidentally take place to the motherboard, the /INH line 
  123. must be pulled low within 330 ns of 0o.
  124.  
  125. 01
  126.             ___________________________                             __________
  127. ___________|       Video phase         |___________________________|
  128.  
  129. 0o
  130. ___________                             ___________________________
  131.            |___________________________|        CPU phase          |__________
  132.  
  133. Q3
  134.             _______________   210 ns    _______________             __________
  135. ___________|    280 ns     |___________|               |___________|
  136.  
  137. ___________________  _________________________________________________________
  138. ADDR               \/
  139. ___________________/\_________________________________________________________
  140.  
  141.          | 190 ns   |
  142.                     | 140 ns |
  143. _________           _________  _________________________________
  144. INH      \_________/         \/            valid                \_____________
  145. _________/         \_________/\_________________________________/
  146.               1         2
  147.  
  148. 1. The INH line can be pulled high at this time.
  149. 2. The INH line can be pulled low (or high) after the addresses are valid at
  150.    190 ns, but before 300 ns (from 0o).
  151.  
  152.                       Figure 1 - INH Line Timing Signals
  153.  
  154. Circuits
  155.  
  156. Figure 2 illustrates a simple example of a circuit that can be used to 
  157. implement the /INH function.
  158.  
  159.                 ________
  160.                |        |
  161.         A15 ---|        |
  162.                | Select |
  163.         A14 ---| Decode |
  164.                | Logic  |             _______
  165.         __/\/--|        |            |       |
  166.                |        |------------|D  7  Q|--- INH* J[1-7]32
  167.         A0  ---|        |  PULLINH*  |   4   |
  168.                |________|            |   L   |
  169.                                      |   S   |
  170.                 |\                   |   3   |
  171.         Q3  ----| >o-----------------|>  7   |
  172.                 |/                   |_  9   |
  173.         0o  -------------------------|G      |
  174.                                      |_______|
  175.  
  176.             Figure 2 - Circuit Implementing /INH Function
  177.  
  178. An Application
  179.  
  180. The circuit in Figure 3 can be used to replace the code in the monitor ROM, 
  181. from location $FC00 to $FFFF, with custom code.  Anytime the address space 
  182. between $FC00-$FFFF is accessed, the /INH line is pulled low, the motherboard 
  183. memory is disabled, and the circuit's 1K RAM is enabled instead.  Part of this 
  184. feature can be disabled and the motherboard memory can be read by keeping the 
  185. switch connected to +5 volts (READDIS).  Whenever the system writes to any 
  186. location in the address space $FC00-$FFFF, the circuit will disable any RAM on 
  187. the motherboard and instead write into the 1K RAM.
  188.  
  189. Here is a series of commands that can be used with the circuit to replace the 
  190. reset vector at $FFFC and $FFFD.  A new reset routine can be written that will 
  191. print the screen or save the status of all the registers whenever the Reset 
  192. key is pressed.
  193.  
  194. Start the system with the circuit's switch connected to +5 (READDIS).  Doing 
  195. so will enable the system to read the monitor ROM during startup, before the 
  196. 1K RAM has been initialized.
  197.  
  198. Get into the monitor by typing CALL -151.  The system prompt should now be an 
  199. asterisk (*).  Copy the monitor ROM into the 1K RAM with the command 
  200. FC00<FC00.FFFFM.  Change the reset vector so that it jumps to location $300 
  201. with this command, FFFC:0, then copy your new reset routine into memory 
  202. starting at location $300.  Now, set the switch to ground (READEN) so all 
  203. future read accesses to $FC00-$FFFF will read the 1K RAM.
  204.  
  205. For example, if these instructions are stored in memory starting at location 
  206. $300, then the system will clear the screen and continue execution in the 
  207. monitor when the Reset key is pressed.
  208.  
  209.     $300:20 58 FC    JSR HOME   (clears screen)
  210.     $303:4C 65 FF    JMP to MON (resume execution in monitor)
  211.  
  212. One of the problems with this circuit is that it also overrides any accesses 
  213. to the language card, therefore any program that uses the language card will 
  214. not work with it.  The circuit does not keep track of which memory is enabled, 
  215. ROM or language card RAM, in the $FC00-$FFFF space.
  216.  
  217. Q3  --------------------------------------------------------+
  218.         _____                                              _|_
  219. A15 ---|     \                                             \ / <--00
  220. A14 ---| 11   )--+                                          O
  221. A13 ---|_____/   |   _____                                  |
  222.                  +--|     \                   _____      ___|___
  223. A12 ----------------| 11   )-----------------|     \    |  \/  _|    ___
  224. A11 ----------------|_____/  +---------------| 11   )---|D     Q|--- INH
  225.                              |            +--|_____/    |       |
  226. A10 -------------------------+  _____     |             |       |
  227. R/W -----+---+-----------------|     \    |             |       |
  228.         _|_  |                 | 00   )O--+             |  379  |
  229. 00  --> \ /  |              +--|_____/                  |       |
  230.          O   |              |                           |       |
  231.         _|___|_____         |            _____          |_      |
  232. A9  ---| __        |        |           /     |--+------|G     Q|---+
  233. A8  ---| OE  WE  CE|------------------O(   00 |  |      |_______|   |
  234. A7  ---|           |--- D7  |           \_____|-----+               |
  235. A6  ---|   2159    |--- D6  |                    |  +---------------+
  236. A5  ---|  1K RAM   |--- D5  |                    |  
  237. A4  ---|           |--- D4  |                    |    ^ +5V
  238. A3  ---|           |--- D3  |                    |    |
  239. A2  ---|           |--- D2  |                    |    o READDIS
  240. A1  ---|           |--- D1  |                    |   /
  241. A0  ---|___________|--- D0  +----------------------o/
  242.                                                  |
  243. PH0 ---------------------------------------------+    o READDEN
  244.                                                     __|__
  245.                                                      ---
  246.                                                       -
  247.  
  248.            Figure 3 - Circuit to Replace Monitor ROM Code
  249.  
  250.  
  251. Further Reference
  252.     o    Apple IIe Technical Reference Manual
  253.  
  254.